test(e2e): backup → fresh-instance restore full-fidelity drill - #63
Merged
Conversation
Adds `backup-restore-fidelity.e2e-spec.ts`: the data-safety proof for 1.0. Unlike the existing backup-restore spec (restores WITHIN one instance, checks only keys + bytes), this drill populates instance A with rich state, takes a whole-instance backup, spawns a FRESH instance B (new DATA_DIR, fresh migrations, a DIFFERENT generated SSE key, same root creds/admin), restores into B, and asserts rich fidelity — documenting every dimension that does NOT survive as an explicit assertion rather than faking a pass. Survives: current object bytes (byte-exact), Content-Type, user-metadata (persistence layer), object tags, bucket versioning status, at-rest SSE round-trip across different instance keys (backup stores decrypted bytes). Gaps asserted (candidate 1.0 data-loss surfaces): prior object versions (only the current pointer row is backed up), per-bucket default-encryption config (restored object is stored PLAINTEXT on B), lifecycle, CORS, policy. Also pins a pre-existing, unrelated S3 read-path bug found while writing this: HEAD never emits x-amz-meta-* headers (metadata is stored + returned by the admin metadata endpoint). User-metadata fidelity is therefore asserted via the admin endpoint, and the HEAD omission has its own clearly-labelled caveat test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
The data-safety proof needed before 1.0. A new e2e spec,
apps/openbucket-backend-e2e/src/backup-restore-fidelity.e2e-spec.ts, thatanswers the real "will my data survive an upgrade" question.
The existing
backup-restore.e2e-spec.tsrestores WITHIN one running instanceand checks only object keys + bytes. This drill instead:
a key; an object with user-metadata + tags + explicit Content-Type; an
at-rest-encrypted object; a bucket with lifecycle + CORS + policy config).
.zip.DATA_DIR, fresh migrations, adifferent generated SSE key (asserted
!=A's), same root creds + admin.Uses the real spawn harness (two instances, ports 9280/9281) — no mocks.
What actually survived vs. the gaps found
SURVIVES (faithfully round-trips into B):
doc.txt,rich.json,secret.bin).row (asserted via the admin metadata endpoint; see caveat below).
?tagging).Enabled).DECRYPTED bytes, so B serves the original plaintext even though B generated its
own SSE key. The bytes are not lost when the instance key changes.
GAPS — asserted as ACTUAL (lossy) behavior; candidate 1.0 data-loss surfaces:
doc.txt; only thecurrent pointer row is backed up (
objectRepo.listByPrefix), so B has exactly?versionIdis ignored on read (unsupported) — even on A there is noway to fetch an old version's bytes over the wire.
encryption after restore (404), and because the writer keys off that
now-missing config, the restored blob is written PLAINTEXT on B — the
at-rest-encryption property is lost even though the bytes survive.
never captures them, though they live on the same bucket row.
Incidental pre-existing bug (NOT a backup defect), pinned by its own test:
S3
HEADnever emitsx-amz-meta-*response headers, even for a freshly-writtenobject — the metadata IS stored (DB) and IS returned by the admin metadata
endpoint. Reproduces on both A and B, so it is a property of the S3 HEAD response
path, not of restore. User-metadata fidelity is therefore asserted through the
admin endpoint, and the HEAD omission has a clearly-labelled caveat test so a
future fix trips it.
Verification
npx nx build openbucket-backend9280/9281 after teardown.
regressions.
nx lint openbucket-backend-e2e: 0 errors for the new file.🤖 Generated with Claude Code